//2009/08/22 22:28:21
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class RoomNumber
{
public:
    int numberOfSets(int roomNumber)
    {
        vector<int> v(10, 0);
        int ret = -1;
        while (roomNumber != 0)
        {
            int a = roomNumber % 10;
            v[a] ++;
            roomNumber /= 10;
        }
		int temp = v[6] + v[9];
		v[6] = (temp + 1) / 2;
		v[9] = (temp + 1) / 2;
        for (int i=0; i<v.size(); i++)
            if (v[i] > ret || ret == -1)
                ret = v[i];
        return ret;
    }
};
